package com.laboratory.report.lab02.lab0204;

import lombok.AllArgsConstructor;

/**
 * 圆柱体
 */
public class Cylinder {

    private Circle circle;
    private double height;

    public Cylinder(double radius, double height) {
        this.circle = new Circle(radius);
        this.height = height;
    }

    public double volume() {
        return circle.area()*height;
    }

    /**
     * 圆
     */
    @AllArgsConstructor
    class Circle {

        /**
         * 半径
         */
        private double radius;

        public double area() {
            return Math.PI*radius*radius;
        }
    }
}
